<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-3"></span><span class="hs-comment">--</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Misc process handling code for SysTools</span><span>
</span><span id="line-5"></span><span class="hs-comment">--</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- (c) The GHC Team 2017</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-9"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.SysTools.Process</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html"><span class="hs-identifier">GHC.Utils.Exception</span></a></span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html"><span class="hs-identifier">GHC.Utils.Panic</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcLoc"><span class="hs-identifier">SrcLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#mkSrcLoc"><span class="hs-identifier">mkSrcLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier">noSrcSpan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#mkSrcSpan"><span class="hs-identifier">mkSrcSpan</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Concurrent.html#"><span class="hs-identifier">Control.Concurrent</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.Exit.html#"><span class="hs-identifier">System.Exit</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.Environment.html#"><span class="hs-identifier">System.Environment</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Error.html#"><span class="hs-identifier">System.IO.Error</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">IO</span></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../process/src/System.Process.html#"><span class="hs-identifier">System.Process</span></a></span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.FileCleanup.html"><span class="hs-identifier">GHC.SysTools.FileCleanup</span></a></span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span class="hs-comment">-- | Enable process jobs support on Windows if it can be expected to work (e.g.</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- @process &gt;= 1.6.9.0@).</span><span>
</span><span id="line-37"></span><span class="annot"><a href="GHC.SysTools.Process.html#enableProcessJobs"><span class="hs-identifier hs-type">enableProcessJobs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../process/src/System.Process.Common.html#CreateProcess"><span class="hs-identifier hs-type">CreateProcess</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../process/src/System.Process.Common.html#CreateProcess"><span class="hs-identifier hs-type">CreateProcess</span></a></span><span class="hs-cpp">
#if defined(MIN_VERSION_process)
</span><span class="hs-cpp">#if MIN_VERSION_process(1,6,9)
</span><span id="enableProcessJobs"><span class="annot"><span class="annottext">enableProcessJobs :: CreateProcess -&gt; CreateProcess
</span><a href="GHC.SysTools.Process.html#enableProcessJobs"><span class="hs-identifier hs-var hs-var">enableProcessJobs</span></a></span></span><span> </span><span id="local-6989586621680944956"><span class="annot"><span class="annottext">CreateProcess
</span><a href="#local-6989586621680944956"><span class="hs-identifier hs-var">opts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CreateProcess
</span><a href="#local-6989586621680944956"><span class="hs-identifier hs-var">opts</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">use_process_jobs :: Bool
</span><a href="../../process/src/System.Process.Common.html#use_process_jobs"><span class="hs-identifier hs-var">use_process_jobs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">}</span><span class="hs-cpp">
#else
</span><span class="hs-identifier">enableProcessJobs</span><span> </span><span class="hs-identifier">opts</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">opts</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#else
</span><span class="hs-identifier">enableProcessJobs</span><span> </span><span class="hs-identifier">opts</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">opts</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- Similar to System.Process.readCreateProcessWithExitCode, but stderr is</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- inherited from the parent process, and output to stderr is not captured.</span><span>
</span><span id="line-50"></span><span class="annot"><a href="GHC.SysTools.Process.html#readCreateProcessWithExitCode%27"><span class="hs-identifier hs-type">readCreateProcessWithExitCode'</span></a></span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../process/src/System.Process.Common.html#CreateProcess"><span class="hs-identifier hs-type">CreateProcess</span></a></span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#ExitCode"><span class="hs-identifier hs-type">ExitCode</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>    </span><span class="hs-comment">-- ^ stdout</span><span>
</span><span id="line-53"></span><span id="readCreateProcessWithExitCode%27"><span class="annot"><span class="annottext">readCreateProcessWithExitCode' :: CreateProcess -&gt; IO (ExitCode, String)
</span><a href="GHC.SysTools.Process.html#readCreateProcessWithExitCode%27"><span class="hs-identifier hs-var hs-var">readCreateProcessWithExitCode'</span></a></span></span><span> </span><span id="local-6989586621680944953"><span class="annot"><span class="annottext">CreateProcess
</span><a href="#local-6989586621680944953"><span class="hs-identifier hs-var">proc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe Handle
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680944952"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944952"><span class="hs-identifier hs-var">outh</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Handle
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944951"><span class="annot"><span class="annottext">ProcessHandle
</span><a href="#local-6989586621680944951"><span class="hs-identifier hs-var">pid</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-55"></span><span>        </span><span class="annot"><span class="annottext">CreateProcess
-&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
</span><a href="../../process/src/System.Process.html#createProcess"><span class="hs-identifier hs-var">createProcess</span></a></span><span> </span><span class="annot"><span class="annottext">(CreateProcess
 -&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle))
-&gt; CreateProcess
-&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CreateProcess -&gt; CreateProcess
</span><a href="GHC.SysTools.Process.html#enableProcessJobs"><span class="hs-identifier hs-var">enableProcessJobs</span></a></span><span> </span><span class="annot"><span class="annottext">(CreateProcess -&gt; CreateProcess) -&gt; CreateProcess -&gt; CreateProcess
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CreateProcess
</span><a href="#local-6989586621680944953"><span class="hs-identifier hs-var">proc</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">std_out :: StdStream
</span><a href="../../process/src/System.Process.Common.html#std_out"><span class="hs-identifier hs-var">std_out</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StdStream
</span><a href="../../process/src/System.Process.Common.html#CreatePipe"><span class="hs-identifier hs-var">CreatePipe</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span>    </span><span class="hs-comment">-- fork off a thread to start consuming the output</span><span>
</span><span id="line-58"></span><span>    </span><span id="local-6989586621680944947"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944947"><span class="hs-identifier hs-var">output</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO String
</span><a href="../../base/src/GHC.IO.Handle.Text.html#hGetContents"><span class="hs-identifier hs-var">hGetContents</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944952"><span class="hs-identifier hs-var">outh</span></a></span><span>
</span><span id="line-59"></span><span>    </span><span id="local-6989586621680944945"><span class="annot"><span class="annottext">MVar ()
</span><a href="#local-6989586621680944945"><span class="hs-identifier hs-var">outMVar</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (MVar ())
forall a. IO (MVar a)
</span><a href="../../base/src/GHC.MVar.html#newEmptyMVar"><span class="hs-identifier hs-var">newEmptyMVar</span></a></span><span>
</span><span id="line-60"></span><span>    </span><span class="annot"><span class="annottext">ThreadId
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO ThreadId
</span><a href="../../base/src/GHC.Conc.Sync.html#forkIO"><span class="hs-identifier hs-var">forkIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ThreadId) -&gt; IO () -&gt; IO ThreadId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO Int
forall a. a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#evaluate"><span class="hs-identifier hs-var">evaluate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944947"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IO Int -&gt; IO () -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MVar () -&gt; () -&gt; IO ()
forall a. MVar a -&gt; a -&gt; IO ()
</span><a href="../../base/src/GHC.MVar.html#putMVar"><span class="hs-identifier hs-var">putMVar</span></a></span><span> </span><span class="annot"><span class="annottext">MVar ()
</span><a href="#local-6989586621680944945"><span class="hs-identifier hs-var">outMVar</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-comment">-- wait on the output</span><span>
</span><span id="line-63"></span><span>    </span><span class="annot"><span class="annottext">MVar () -&gt; IO ()
forall a. MVar a -&gt; IO a
</span><a href="../../base/src/GHC.MVar.html#takeMVar"><span class="hs-identifier hs-var">takeMVar</span></a></span><span> </span><span class="annot"><span class="annottext">MVar ()
</span><a href="#local-6989586621680944945"><span class="hs-identifier hs-var">outMVar</span></a></span><span>
</span><span id="line-64"></span><span>    </span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hClose"><span class="hs-identifier hs-var">hClose</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944952"><span class="hs-identifier hs-var">outh</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-comment">-- wait on the process</span><span>
</span><span id="line-67"></span><span>    </span><span id="local-6989586621680944937"><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944937"><span class="hs-identifier hs-var">ex</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ProcessHandle -&gt; IO ExitCode
</span><a href="../../process/src/System.Process.html#waitForProcess"><span class="hs-identifier hs-var">waitForProcess</span></a></span><span> </span><span class="annot"><span class="annottext">ProcessHandle
</span><a href="#local-6989586621680944951"><span class="hs-identifier hs-var">pid</span></a></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span>    </span><span class="annot"><span class="annottext">(ExitCode, String) -&gt; IO (ExitCode, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944937"><span class="hs-identifier hs-var">ex</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944947"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="annot"><a href="GHC.SysTools.Process.html#replaceVar"><span class="hs-identifier hs-type">replaceVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-72"></span><span id="replaceVar"><span class="annot"><span class="annottext">replaceVar :: (String, String) -&gt; [(String, String)] -&gt; [(String, String)]
</span><a href="GHC.SysTools.Process.html#replaceVar"><span class="hs-identifier hs-var hs-var">replaceVar</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944934"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944934"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944933"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944933"><span class="hs-identifier hs-var">value</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680944932"><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621680944932"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944934"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944933"><span class="hs-identifier hs-var">value</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; [(String, String)] -&gt; [(String, String)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">((String, String) -&gt; Bool)
-&gt; [(String, String)] -&gt; [(String, String)]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621680944931"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944931"><span class="hs-identifier hs-var">var'</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944934"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944931"><span class="hs-identifier hs-var">var'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621680944932"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="hs-comment">-- | Version of @System.Process.readProcessWithExitCode@ that takes a</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- key-value tuple to insert into the environment.</span><span>
</span><span id="line-77"></span><span class="annot"><a href="GHC.SysTools.Process.html#readProcessEnvWithExitCode"><span class="hs-identifier hs-type">readProcessEnvWithExitCode</span></a></span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-comment">-- ^ program path</span><span>
</span><span id="line-79"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ program args</span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ addition to the environment</span><span>
</span><span id="line-81"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#ExitCode"><span class="hs-identifier hs-type">ExitCode</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ (exit_code, stdout, stderr)</span><span>
</span><span id="line-82"></span><span id="readProcessEnvWithExitCode"><span class="annot"><span class="annottext">readProcessEnvWithExitCode :: String
-&gt; [String] -&gt; (String, String) -&gt; IO (ExitCode, String, String)
</span><a href="GHC.SysTools.Process.html#readProcessEnvWithExitCode"><span class="hs-identifier hs-var hs-var">readProcessEnvWithExitCode</span></a></span></span><span> </span><span id="local-6989586621680944928"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944928"><span class="hs-identifier hs-var">prog</span></a></span></span><span> </span><span id="local-6989586621680944927"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944927"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680944926"><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621680944926"><span class="hs-identifier hs-var">env_update</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-83"></span><span>    </span><span id="local-6989586621680944925"><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621680944925"><span class="hs-identifier hs-var">current_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO [(String, String)]
</span><a href="../../base/src/System.Environment.html#getEnvironment"><span class="hs-identifier hs-var">getEnvironment</span></a></span><span>
</span><span id="line-84"></span><span>    </span><span class="annot"><span class="annottext">CreateProcess -&gt; String -&gt; IO (ExitCode, String, String)
</span><a href="../../process/src/System.Process.html#readCreateProcessWithExitCode"><span class="hs-identifier hs-var">readCreateProcessWithExitCode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; CreateProcess
</span><a href="../../process/src/System.Process.html#proc"><span class="hs-identifier hs-var">proc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944928"><span class="hs-identifier hs-var">prog</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944927"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-85"></span><span>        </span><span class="annot"><span class="annottext">env :: Maybe [(String, String)]
</span><a href="../../process/src/System.Process.Common.html#env"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(String, String)] -&gt; Maybe [(String, String)]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String, String) -&gt; [(String, String)] -&gt; [(String, String)]
</span><a href="GHC.SysTools.Process.html#replaceVar"><span class="hs-identifier hs-var">replaceVar</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621680944926"><span class="hs-identifier hs-var">env_update</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621680944925"><span class="hs-identifier hs-var">current_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-comment">-- Don't let gcc localize version info string, #8825</span><span>
</span><span id="line-88"></span><span class="annot"><a href="GHC.SysTools.Process.html#c_locale_env"><span class="hs-identifier hs-type">c_locale_env</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span id="c_locale_env"><span class="annot"><span class="annottext">c_locale_env :: (String, String)
</span><a href="GHC.SysTools.Process.html#c_locale_env"><span class="hs-identifier hs-var hs-var">c_locale_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LANGUAGE&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;C&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="hs-comment">-- If the -B&lt;dir&gt; option is set, add &lt;dir&gt; to PATH.  This works around</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- a bug in gcc on Windows Vista where it can't find its auxiliary</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- binaries (see bug #1110).</span><span>
</span><span id="line-94"></span><span class="annot"><a href="GHC.SysTools.Process.html#getGccEnv"><span class="hs-identifier hs-type">getGccEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-95"></span><span id="getGccEnv"><span class="annot"><span class="annottext">getGccEnv :: [Option] -&gt; IO (Maybe [(String, String)])
</span><a href="GHC.SysTools.Process.html#getGccEnv"><span class="hs-identifier hs-var hs-var">getGccEnv</span></a></span></span><span> </span><span id="local-6989586621680944918"><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944918"><span class="hs-identifier hs-var">opts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-96"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944916"><span class="hs-identifier hs-var">b_dirs</span></a></span><span>
</span><span id="line-97"></span><span>     </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe [(String, String)] -&gt; IO (Maybe [(String, String)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe [(String, String)]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-98"></span><span>     </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680944915"><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621680944915"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO [(String, String)]
</span><a href="../../base/src/System.Environment.html#getEnvironment"><span class="hs-identifier hs-var">getEnvironment</span></a></span><span>
</span><span id="line-99"></span><span>             </span><span class="annot"><span class="annottext">Maybe [(String, String)] -&gt; IO (Maybe [(String, String)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(String, String)] -&gt; Maybe [(String, String)]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(String, String)] -&gt; [(String, String)]
</span><a href="#local-6989586621680944914"><span class="hs-identifier hs-var">mangle_paths</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621680944915"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-100"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-101"></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621680944916"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944916"><span class="hs-identifier hs-var">b_dirs</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Option]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Option -&gt; Either String Option)
-&gt; [Option] -&gt; ([String], [Option])
forall a b c. (a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-var">partitionWith</span></a></span><span> </span><span class="annot"><span class="annottext">Option -&gt; Either String Option
</span><a href="#local-6989586621680944912"><span class="hs-identifier hs-var">get_b_opt</span></a></span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944918"><span class="hs-identifier hs-var">opts</span></a></span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span>  </span><span id="local-6989586621680944912"><span class="annot"><span class="annottext">get_b_opt :: Option -&gt; Either String Option
</span><a href="#local-6989586621680944912"><span class="hs-identifier hs-var hs-var">get_b_opt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'B'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944910"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944910"><span class="hs-identifier hs-var">dir</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String Option
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944910"><span class="hs-identifier hs-var">dir</span></a></span><span>
</span><span id="line-104"></span><span>  </span><span class="annot"><a href="#local-6989586621680944912"><span class="hs-identifier hs-var">get_b_opt</span></a></span><span> </span><span id="local-6989586621680944909"><span class="annot"><span class="annottext">Option
</span><a href="#local-6989586621680944909"><span class="hs-identifier hs-var">other</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Option -&gt; Either String Option
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">Option
</span><a href="#local-6989586621680944909"><span class="hs-identifier hs-var">other</span></a></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>  </span><span class="hs-comment">-- Work around #1110 on Windows only (lest we stumble into #17266).</span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span>  </span><span id="local-6989586621680944914"><span class="annot"><span class="annottext">mangle_paths :: [(String, String)] -&gt; [(String, String)]
</span><a href="#local-6989586621680944914"><span class="hs-identifier hs-var hs-var">mangle_paths</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((String, String) -&gt; (String, String))
-&gt; [(String, String)] -&gt; [(String, String)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; (String, String)
</span><a href="#local-6989586621680944908"><span class="hs-identifier hs-var">mangle_path</span></a></span><span>
</span><span id="line-109"></span><span>  </span><span id="local-6989586621680944908"><span class="annot"><span class="annottext">mangle_path :: (String, String) -&gt; (String, String)
</span><a href="#local-6989586621680944908"><span class="hs-identifier hs-var hs-var">mangle_path</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944905"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944905"><span class="hs-identifier hs-var">path</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680944904"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944904"><span class="hs-identifier hs-var">paths</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; String -&gt; String
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="../../base/src/GHC.Unicode.html#toUpper"><span class="hs-identifier hs-var">toUpper</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944905"><span class="hs-identifier hs-var">path</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;PATH&quot;</span></span><span>
</span><span id="line-110"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944905"><span class="hs-identifier hs-var">path</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\&quot;'</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944916"><span class="hs-identifier hs-var">b_dirs</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944904"><span class="hs-identifier hs-var">paths</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span>  </span><span class="annot"><a href="#local-6989586621680944908"><span class="hs-identifier hs-var">mangle_path</span></a></span><span> </span><span id="local-6989586621680944901"><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621680944901"><span class="hs-identifier hs-var">other</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621680944901"><span class="hs-identifier hs-var">other</span></a></span><span class="hs-cpp">
#else
</span><span>  </span><span class="hs-identifier">mangle_paths</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">id</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- Running an external program</span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span class="annot"><a href="GHC.SysTools.Process.html#runSomething"><span class="hs-identifier hs-type">runSomething</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-121"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>          </span><span class="hs-comment">-- For -v message</span><span>
</span><span id="line-122"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>          </span><span class="hs-comment">-- Command name (possibly a full path)</span><span>
</span><span id="line-123"></span><span>                                </span><span class="hs-comment">--      assumed already dos-ified</span><span>
</span><span id="line-124"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span class="hs-special">]</span><span>        </span><span class="hs-comment">-- Arguments</span><span>
</span><span id="line-125"></span><span>                                </span><span class="hs-comment">--      runSomething will dos-ify them</span><span>
</span><span id="line-126"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span id="runSomething"><span class="annot"><span class="annottext">runSomething :: DynFlags -&gt; String -&gt; String -&gt; [Option] -&gt; IO ()
</span><a href="GHC.SysTools.Process.html#runSomething"><span class="hs-identifier hs-var hs-var">runSomething</span></a></span></span><span> </span><span id="local-6989586621680944899"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944899"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680944898"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944898"><span class="hs-identifier hs-var">phase_name</span></a></span></span><span> </span><span id="local-6989586621680944897"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944897"><span class="hs-identifier hs-var">pgm</span></a></span></span><span> </span><span id="local-6989586621680944896"><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944896"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-129"></span><span>  </span><span class="annot"><span class="annottext">DynFlags
-&gt; (String -&gt; String)
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; Maybe String
-&gt; Maybe [(String, String)]
-&gt; IO ()
</span><a href="GHC.SysTools.Process.html#runSomethingFiltered"><span class="hs-identifier hs-var">runSomethingFiltered</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944899"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944898"><span class="hs-identifier hs-var">phase_name</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944897"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944896"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe [(String, String)]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="hs-comment">-- | Run a command, placing the arguments in an external response file.</span><span>
</span><span id="line-132"></span><span class="hs-comment">--</span><span>
</span><span id="line-133"></span><span class="hs-comment">-- This command is used in order to avoid overlong command line arguments on</span><span>
</span><span id="line-134"></span><span class="hs-comment">-- Windows. The command line arguments are first written to an external,</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- temporary response file, and then passed to the linker via @filepath.</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- response files for passing them in. See:</span><span>
</span><span id="line-137"></span><span class="hs-comment">--</span><span>
</span><span id="line-138"></span><span class="hs-comment">--     https://gcc.gnu.org/wiki/Response_Files</span><span>
</span><span id="line-139"></span><span class="hs-comment">--     https://gitlab.haskell.org/ghc/ghc/issues/10777</span><span>
</span><span id="line-140"></span><span class="annot"><a href="GHC.SysTools.Process.html#runSomethingResponseFile"><span class="hs-identifier hs-type">runSomethingResponseFile</span></a></span><span>
</span><span id="line-141"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-142"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span id="runSomethingResponseFile"><span class="annot"><span class="annottext">runSomethingResponseFile :: DynFlags
-&gt; (String -&gt; String)
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; Maybe [(String, String)]
-&gt; IO ()
</span><a href="GHC.SysTools.Process.html#runSomethingResponseFile"><span class="hs-identifier hs-var hs-var">runSomethingResponseFile</span></a></span></span><span> </span><span id="local-6989586621680944892"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944892"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680944891"><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944891"><span class="hs-identifier hs-var">filter_fn</span></a></span></span><span> </span><span id="local-6989586621680944890"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944890"><span class="hs-identifier hs-var">phase_name</span></a></span></span><span> </span><span id="local-6989586621680944889"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944889"><span class="hs-identifier hs-var">pgm</span></a></span></span><span> </span><span id="local-6989586621680944888"><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944888"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680944887"><span class="annot"><span class="annottext">Maybe [(String, String)]
</span><a href="#local-6989586621680944887"><span class="hs-identifier hs-var">mb_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-145"></span><span>    </span><span class="annot"><span class="annottext">DynFlags
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; ([String] -&gt; IO (ExitCode, ()))
-&gt; IO ()
forall a.
DynFlags
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; ([String] -&gt; IO (ExitCode, a))
-&gt; IO a
</span><a href="GHC.SysTools.Process.html#runSomethingWith"><span class="hs-identifier hs-var">runSomethingWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944892"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944890"><span class="hs-identifier hs-var">phase_name</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944889"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944888"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">(([String] -&gt; IO (ExitCode, ())) -&gt; IO ())
-&gt; ([String] -&gt; IO (ExitCode, ())) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680944885"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944885"><span class="hs-identifier hs-var">real_args</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-146"></span><span>        </span><span id="local-6989586621680944884"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944884"><span class="hs-identifier hs-var">fp</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO String
forall {t :: * -&gt; *}. Foldable t =&gt; [t Char] -&gt; IO String
</span><a href="#local-6989586621680944883"><span class="hs-identifier hs-var">getResponseFile</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944885"><span class="hs-identifier hs-var">real_args</span></a></span><span>
</span><span id="line-147"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680944882"><span class="annot"><span class="annottext">args :: [String]
</span><a href="#local-6989586621680944882"><span class="hs-identifier hs-var hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'@'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944884"><span class="hs-identifier hs-var">fp</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-148"></span><span>        </span><span id="local-6989586621680944881"><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944881"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; (String -&gt; String)
-&gt; String
-&gt; [String]
-&gt; Maybe String
-&gt; Maybe [(String, String)]
-&gt; IO ExitCode
</span><a href="GHC.SysTools.Process.html#builderMainLoop"><span class="hs-identifier hs-var">builderMainLoop</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944892"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944891"><span class="hs-identifier hs-var">filter_fn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944889"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944882"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe [(String, String)]
</span><a href="#local-6989586621680944887"><span class="hs-identifier hs-var">mb_env</span></a></span><span>
</span><span id="line-149"></span><span>        </span><span class="annot"><span class="annottext">(ExitCode, ()) -&gt; IO (ExitCode, ())
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944881"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-151"></span><span>    </span><span id="local-6989586621680944883"><span class="annot"><span class="annottext">getResponseFile :: [t Char] -&gt; IO String
</span><a href="#local-6989586621680944883"><span class="hs-identifier hs-var hs-var">getResponseFile</span></a></span></span><span> </span><span id="local-6989586621680944873"><span class="annot"><span class="annottext">[t Char]
</span><a href="#local-6989586621680944873"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-152"></span><span>      </span><span id="local-6989586621680944872"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944872"><span class="hs-identifier hs-var">fp</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TempFileLifetime -&gt; String -&gt; IO String
</span><a href="GHC.SysTools.FileCleanup.html#newTempName"><span class="hs-identifier hs-var">newTempName</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944892"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TempFileLifetime
</span><a href="GHC.SysTools.FileCleanup.html#TFL_CurrentModule"><span class="hs-identifier hs-var">TFL_CurrentModule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;rsp&quot;</span></span><span>
</span><span id="line-153"></span><span>      </span><span class="annot"><span class="annottext">String -&gt; IOMode -&gt; (Handle -&gt; IO ()) -&gt; IO ()
forall r. String -&gt; IOMode -&gt; (Handle -&gt; IO r) -&gt; IO r
</span><a href="../../base/src/System.IO.html#withFile"><span class="hs-identifier hs-var">withFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944872"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#WriteMode"><span class="hs-identifier hs-var">WriteMode</span></a></span><span> </span><span class="annot"><span class="annottext">((Handle -&gt; IO ()) -&gt; IO ()) -&gt; (Handle -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680944867"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944867"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span>          </span><span class="annot"><span class="annottext">Handle -&gt; TextEncoding -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hSetEncoding"><span class="hs-identifier hs-var">hSetEncoding</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944867"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">TextEncoding
</span><a href="../../base/src/GHC.IO.Encoding.html#latin1"><span class="hs-identifier hs-var">latin1</span></a></span><span class="hs-cpp">
#else
</span><span>          </span><span class="hs-identifier">hSetEncoding</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">utf8</span><span class="hs-cpp">
#endif
</span><span>          </span><span class="annot"><span class="annottext">Handle -&gt; String -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.Text.html#hPutStr"><span class="hs-identifier hs-var">hPutStr</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944867"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; String -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String) -&gt; [String] -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(t Char -&gt; String) -&gt; [t Char] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">t Char -&gt; String
forall {t :: * -&gt; *}. Foldable t =&gt; t Char -&gt; String
</span><a href="#local-6989586621680944862"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">[t Char]
</span><a href="#local-6989586621680944873"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-160"></span><span>      </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944872"><span class="hs-identifier hs-var">fp</span></a></span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>    </span><span class="hs-comment">-- Note: Response files have backslash-escaping, double quoting, and are</span><span>
</span><span id="line-163"></span><span>    </span><span class="hs-comment">-- whitespace separated (some implementations use newline, others any</span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-comment">-- whitespace character). Therefore, escape any backslashes, newlines, and</span><span>
</span><span id="line-165"></span><span>    </span><span class="hs-comment">-- double quotes in the argument, and surround the content with double</span><span>
</span><span id="line-166"></span><span>    </span><span class="hs-comment">-- quotes.</span><span>
</span><span id="line-167"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-comment">-- Another possibility that could be considered would be to convert</span><span>
</span><span id="line-169"></span><span>    </span><span class="hs-comment">-- backslashes in the argument to forward slashes. This would generally do</span><span>
</span><span id="line-170"></span><span>    </span><span class="hs-comment">-- the right thing, since backslashes in general only appear in arguments</span><span>
</span><span id="line-171"></span><span>    </span><span class="hs-comment">-- as part of file paths on Windows, and the forward slash is accepted for</span><span>
</span><span id="line-172"></span><span>    </span><span class="hs-comment">-- those. However, escaping is more reliable, in case somehow a backslash</span><span>
</span><span id="line-173"></span><span>    </span><span class="hs-comment">-- appears in a non-file.</span><span>
</span><span id="line-174"></span><span>    </span><span id="local-6989586621680944862"><span class="annot"><span class="annottext">escape :: t Char -&gt; String
</span><a href="#local-6989586621680944862"><span class="hs-identifier hs-var hs-var">escape</span></a></span></span><span> </span><span id="local-6989586621680944858"><span class="annot"><span class="annottext">t Char
</span><a href="#local-6989586621680944858"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span>
</span><span id="line-175"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span>
</span><span id="line-176"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; String) -&gt; t Char -&gt; String
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span>
</span><span id="line-177"></span><span>            </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680944855"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944855"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-178"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944855"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-179"></span><span>                    </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\\\&quot;</span></span><span>
</span><span id="line-180"></span><span>                    </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\n&quot;</span></span><span>
</span><span id="line-181"></span><span>                    </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\&quot;'</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\\&quot;&quot;</span></span><span>
</span><span id="line-182"></span><span>                    </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944855"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>            </span><span class="annot"><span class="annottext">t Char
</span><a href="#local-6989586621680944858"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-184"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span>
</span><span id="line-185"></span><span>        </span><span class="hs-special">]</span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="annot"><a href="GHC.SysTools.Process.html#runSomethingFiltered"><span class="hs-identifier hs-type">runSomethingFiltered</span></a></span><span>
</span><span id="line-188"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-189"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span id="runSomethingFiltered"><span class="annot"><span class="annottext">runSomethingFiltered :: DynFlags
-&gt; (String -&gt; String)
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; Maybe String
-&gt; Maybe [(String, String)]
-&gt; IO ()
</span><a href="GHC.SysTools.Process.html#runSomethingFiltered"><span class="hs-identifier hs-var hs-var">runSomethingFiltered</span></a></span></span><span> </span><span id="local-6989586621680944853"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944853"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680944852"><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944852"><span class="hs-identifier hs-var">filter_fn</span></a></span></span><span> </span><span id="local-6989586621680944851"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944851"><span class="hs-identifier hs-var">phase_name</span></a></span></span><span> </span><span id="local-6989586621680944850"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944850"><span class="hs-identifier hs-var">pgm</span></a></span></span><span> </span><span id="local-6989586621680944849"><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944849"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680944848"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621680944848"><span class="hs-identifier hs-var">mb_cwd</span></a></span></span><span> </span><span id="local-6989586621680944847"><span class="annot"><span class="annottext">Maybe [(String, String)]
</span><a href="#local-6989586621680944847"><span class="hs-identifier hs-var">mb_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-192"></span><span>    </span><span class="annot"><span class="annottext">DynFlags
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; ([String] -&gt; IO (ExitCode, ()))
-&gt; IO ()
forall a.
DynFlags
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; ([String] -&gt; IO (ExitCode, a))
-&gt; IO a
</span><a href="GHC.SysTools.Process.html#runSomethingWith"><span class="hs-identifier hs-var">runSomethingWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944853"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944851"><span class="hs-identifier hs-var">phase_name</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944850"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944849"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">(([String] -&gt; IO (ExitCode, ())) -&gt; IO ())
-&gt; ([String] -&gt; IO (ExitCode, ())) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680944846"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944846"><span class="hs-identifier hs-var">real_args</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-193"></span><span>        </span><span id="local-6989586621680944845"><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944845"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; (String -&gt; String)
-&gt; String
-&gt; [String]
-&gt; Maybe String
-&gt; Maybe [(String, String)]
-&gt; IO ExitCode
</span><a href="GHC.SysTools.Process.html#builderMainLoop"><span class="hs-identifier hs-var">builderMainLoop</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944853"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944852"><span class="hs-identifier hs-var">filter_fn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944850"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944846"><span class="hs-identifier hs-var">real_args</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621680944848"><span class="hs-identifier hs-var">mb_cwd</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe [(String, String)]
</span><a href="#local-6989586621680944847"><span class="hs-identifier hs-var">mb_env</span></a></span><span>
</span><span id="line-194"></span><span>        </span><span class="annot"><span class="annottext">(ExitCode, ()) -&gt; IO (ExitCode, ())
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944845"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span id="local-6989586621680945064"><span class="annot"><a href="GHC.SysTools.Process.html#runSomethingWith"><span class="hs-identifier hs-type">runSomethingWith</span></a></span><span>
</span><span id="line-197"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-198"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#ExitCode"><span class="hs-identifier hs-type">ExitCode</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680945064"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680945064"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-200"></span><span>
</span><span id="line-201"></span><span id="runSomethingWith"><span class="annot"><span class="annottext">runSomethingWith :: forall a.
DynFlags
-&gt; String
-&gt; String
-&gt; [Option]
-&gt; ([String] -&gt; IO (ExitCode, a))
-&gt; IO a
</span><a href="GHC.SysTools.Process.html#runSomethingWith"><span class="hs-identifier hs-var hs-var">runSomethingWith</span></a></span></span><span> </span><span id="local-6989586621680944844"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944844"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680944843"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944843"><span class="hs-identifier hs-var">phase_name</span></a></span></span><span> </span><span id="local-6989586621680944842"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944842"><span class="hs-identifier hs-var">pgm</span></a></span></span><span> </span><span id="local-6989586621680944841"><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944841"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680944840"><span class="annot"><span class="annottext">[String] -&gt; IO (ExitCode, a)
</span><a href="#local-6989586621680944840"><span class="hs-identifier hs-var">io</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-202"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680944839"><span class="annot"><span class="annottext">real_args :: [String]
</span><a href="#local-6989586621680944839"><span class="hs-identifier hs-var hs-var">real_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Bool) -&gt; [String] -&gt; [String]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Option -&gt; String) -&gt; [Option] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Option -&gt; String
</span><a href="GHC.Utils.CliOption.html#showOpt"><span class="hs-identifier hs-var">showOpt</span></a></span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621680944841"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-203"></span><span>      </span><span id="local-6989586621680944836"><span class="annot"><span class="annottext">cmdLine :: String
</span><a href="#local-6989586621680944836"><span class="hs-identifier hs-var hs-var">cmdLine</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; String
</span><a href="../../process/src/System.Process.html#showCommandForUser"><span class="hs-identifier hs-var">showCommandForUser</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944842"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944839"><span class="hs-identifier hs-var">real_args</span></a></span><span>
</span><span id="line-204"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; String -&gt; IO a -&gt; IO a
forall a. DynFlags -&gt; String -&gt; String -&gt; IO a -&gt; IO a
</span><a href="GHC.Utils.Error.html#traceCmd"><span class="hs-identifier hs-var">traceCmd</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944844"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944843"><span class="hs-identifier hs-var">phase_name</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944836"><span class="hs-identifier hs-var">cmdLine</span></a></span><span> </span><span class="annot"><span class="annottext">(IO a -&gt; IO a) -&gt; IO a -&gt; IO a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; IO (ExitCode, a) -&gt; IO a
forall r. String -&gt; String -&gt; IO (ExitCode, r) -&gt; IO r
</span><a href="GHC.SysTools.Process.html#handleProc"><span class="hs-identifier hs-var">handleProc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944842"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944843"><span class="hs-identifier hs-var">phase_name</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (ExitCode, a) -&gt; IO a) -&gt; IO (ExitCode, a) -&gt; IO a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO (ExitCode, a)
</span><a href="#local-6989586621680944840"><span class="hs-identifier hs-var">io</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944839"><span class="hs-identifier hs-var">real_args</span></a></span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span id="local-6989586621680945049"><span class="annot"><a href="GHC.SysTools.Process.html#handleProc"><span class="hs-identifier hs-type">handleProc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#ExitCode"><span class="hs-identifier hs-type">ExitCode</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680945049"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680945049"><span class="hs-identifier hs-type">r</span></a></span></span><span>
</span><span id="line-207"></span><span id="handleProc"><span class="annot"><span class="annottext">handleProc :: forall r. String -&gt; String -&gt; IO (ExitCode, r) -&gt; IO r
</span><a href="GHC.SysTools.Process.html#handleProc"><span class="hs-identifier hs-var hs-var">handleProc</span></a></span></span><span> </span><span id="local-6989586621680944828"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944828"><span class="hs-identifier hs-var">pgm</span></a></span></span><span> </span><span id="local-6989586621680944827"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944827"><span class="hs-identifier hs-var">phase_name</span></a></span></span><span> </span><span id="local-6989586621680944826"><span class="annot"><span class="annottext">IO (ExitCode, r)
</span><a href="#local-6989586621680944826"><span class="hs-identifier hs-var">proc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680944825"><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944825"><span class="hs-identifier hs-var">rc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944824"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680944824"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (ExitCode, r)
</span><a href="#local-6989586621680944826"><span class="hs-identifier hs-var">proc</span></a></span><span> </span><span class="annot"><span class="annottext">IO (ExitCode, r)
-&gt; (IOException -&gt; IO (ExitCode, r)) -&gt; IO (ExitCode, r)
forall a. IO a -&gt; (IOException -&gt; IO a) -&gt; IO a
</span><a href="GHC.Utils.Exception.html#catchIO"><span class="hs-operator hs-var">`catchIO`</span></a></span><span> </span><span class="annot"><span class="annottext">IOException -&gt; IO (ExitCode, r)
forall {a}. IOException -&gt; IO a
</span><a href="#local-6989586621680944822"><span class="hs-identifier hs-var">handler</span></a></span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ExitCode
</span><a href="#local-6989586621680944825"><span class="hs-identifier hs-var">rc</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-210"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#ExitSuccess"><span class="hs-identifier hs-type">ExitSuccess</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">r -&gt; IO r
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680944824"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-211"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#ExitFailure"><span class="hs-identifier hs-type">ExitFailure</span></a></span><span> </span><span id="local-6989586621680944819"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944819"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO r
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-212"></span><span>            </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;`&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#takeFileName"><span class="hs-identifier hs-var">takeFileName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944828"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-213"></span><span>                          </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; failed in phase `&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944827"><span class="hs-identifier hs-var">phase_name</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'.&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-214"></span><span>                          </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; (Exit code: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944819"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-215"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-216"></span><span>    </span><span id="local-6989586621680944822"><span class="annot"><span class="annottext">handler :: IOException -&gt; IO a
</span><a href="#local-6989586621680944822"><span class="hs-identifier hs-var hs-var">handler</span></a></span></span><span> </span><span id="local-6989586621680944812"><span class="annot"><span class="annottext">IOException
</span><a href="#local-6989586621680944812"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-217"></span><span>       </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">IOException -&gt; Bool
</span><a href="../../base/src/System.IO.Error.html#isDoesNotExistError"><span class="hs-identifier hs-var">IO.isDoesNotExistError</span></a></span><span> </span><span class="annot"><span class="annottext">IOException
</span><a href="#local-6989586621680944812"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-218"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">IO a
forall {a}. IO a
</span><a href="#local-6989586621680944810"><span class="hs-identifier hs-var">does_not_exist</span></a></span><span>
</span><span id="line-219"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO a
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; GhcException) -&gt; String -&gt; GhcException
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IOException -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">IOException
</span><a href="#local-6989586621680944812"><span class="hs-identifier hs-var">err</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span>    </span><span id="local-6989586621680944810"><span class="annot"><span class="annottext">does_not_exist :: IO a
</span><a href="#local-6989586621680944810"><span class="hs-identifier hs-var hs-var">does_not_exist</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO a
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#InstallationError"><span class="hs-identifier hs-var">InstallationError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;could not execute: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944828"><span class="hs-identifier hs-var">pgm</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span class="annot"><a href="GHC.SysTools.Process.html#builderMainLoop"><span class="hs-identifier hs-type">builderMainLoop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-225"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-226"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#ExitCode"><span class="hs-identifier hs-type">ExitCode</span></a></span><span>
</span><span id="line-227"></span><span id="builderMainLoop"><span class="annot"><span class="annottext">builderMainLoop :: DynFlags
-&gt; (String -&gt; String)
-&gt; String
-&gt; [String]
-&gt; Maybe String
-&gt; Maybe [(String, String)]
-&gt; IO ExitCode
</span><a href="GHC.SysTools.Process.html#builderMainLoop"><span class="hs-identifier hs-var hs-var">builderMainLoop</span></a></span></span><span> </span><span id="local-6989586621680944808"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944808"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680944807"><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944807"><span class="hs-identifier hs-var">filter_fn</span></a></span></span><span> </span><span id="local-6989586621680944806"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944806"><span class="hs-identifier hs-var">pgm</span></a></span></span><span> </span><span id="local-6989586621680944805"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944805"><span class="hs-identifier hs-var">real_args</span></a></span></span><span> </span><span id="local-6989586621680944804"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621680944804"><span class="hs-identifier hs-var">mb_cwd</span></a></span></span><span> </span><span id="local-6989586621680944803"><span class="annot"><span class="annottext">Maybe [(String, String)]
</span><a href="#local-6989586621680944803"><span class="hs-identifier hs-var">mb_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-228"></span><span>  </span><span id="local-6989586621680944802"><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944802"><span class="hs-identifier hs-var">chan</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (Chan BuildMessage)
forall a. IO (Chan a)
</span><a href="../../base/src/Control.Concurrent.Chan.html#newChan"><span class="hs-identifier hs-var">newChan</span></a></span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span>  </span><span class="hs-comment">-- We use a mask here rather than a bracket because we want</span><span>
</span><span id="line-231"></span><span>  </span><span class="hs-comment">-- to distinguish between cleaning up with and without an</span><span>
</span><span id="line-232"></span><span>  </span><span class="hs-comment">-- exception. This is to avoid calling terminateProcess</span><span>
</span><span id="line-233"></span><span>  </span><span class="hs-comment">-- unless an exception was raised.</span><span>
</span><span id="line-234"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680944791"><span class="annot"><span class="annottext">safely :: (ProcessHandle -&gt; IO b) -&gt; IO b
</span><a href="#local-6989586621680944791"><span class="hs-identifier hs-var hs-var">safely</span></a></span></span><span> </span><span id="local-6989586621680944790"><span class="annot"><span class="annottext">ProcessHandle -&gt; IO b
</span><a href="#local-6989586621680944790"><span class="hs-identifier hs-var">inner</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((forall a. IO a -&gt; IO a) -&gt; IO b) -&gt; IO b
forall b. ((forall a. IO a -&gt; IO a) -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.IO.html#mask"><span class="hs-identifier hs-var">mask</span></a></span><span> </span><span class="annot"><span class="annottext">(((forall a. IO a -&gt; IO a) -&gt; IO b) -&gt; IO b)
-&gt; ((forall a. IO a -&gt; IO a) -&gt; IO b) -&gt; IO b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680944788"><span class="annot"><span class="annottext">forall a. IO a -&gt; IO a
</span><a href="#local-6989586621680944788"><span class="hs-identifier hs-var">restore</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-235"></span><span>        </span><span class="hs-comment">-- acquire</span><span>
</span><span id="line-236"></span><span>        </span><span class="hs-comment">-- On Windows due to how exec is emulated the old process will exit and</span><span>
</span><span id="line-237"></span><span>        </span><span class="hs-comment">-- a new process will be created. This means waiting for termination of</span><span>
</span><span id="line-238"></span><span>        </span><span class="hs-comment">-- the parent process will get you in a race condition as the child may</span><span>
</span><span id="line-239"></span><span>        </span><span class="hs-comment">-- not have finished yet.  This caused #16450.  To fix this use a</span><span>
</span><span id="line-240"></span><span>        </span><span class="hs-comment">-- process job to track all child processes and wait for each one to</span><span>
</span><span id="line-241"></span><span>        </span><span class="hs-comment">-- finish.</span><span>
</span><span id="line-242"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680944787"><span class="annot"><span class="annottext">procdata :: CreateProcess
</span><a href="#local-6989586621680944787"><span class="hs-identifier hs-var hs-var">procdata</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-243"></span><span>              </span><span class="annot"><span class="annottext">CreateProcess -&gt; CreateProcess
</span><a href="GHC.SysTools.Process.html#enableProcessJobs"><span class="hs-identifier hs-var">enableProcessJobs</span></a></span><span>
</span><span id="line-244"></span><span>              </span><span class="annot"><span class="annottext">(CreateProcess -&gt; CreateProcess) -&gt; CreateProcess -&gt; CreateProcess
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; CreateProcess
</span><a href="../../process/src/System.Process.html#proc"><span class="hs-identifier hs-var">proc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944806"><span class="hs-identifier hs-var">pgm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944805"><span class="hs-identifier hs-var">real_args</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cwd :: Maybe String
</span><a href="../../process/src/System.Process.Common.html#cwd"><span class="hs-identifier hs-var">cwd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621680944804"><span class="hs-identifier hs-var">mb_cwd</span></a></span><span>
</span><span id="line-245"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">env :: Maybe [(String, String)]
</span><a href="../../process/src/System.Process.Common.html#env"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [(String, String)]
</span><a href="#local-6989586621680944803"><span class="hs-identifier hs-var">mb_env</span></a></span><span>
</span><span id="line-246"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">std_in :: StdStream
</span><a href="../../process/src/System.Process.Common.html#std_in"><span class="hs-identifier hs-var">std_in</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StdStream
</span><a href="../../process/src/System.Process.Common.html#CreatePipe"><span class="hs-identifier hs-var">CreatePipe</span></a></span><span>
</span><span id="line-247"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">std_out :: StdStream
</span><a href="../../process/src/System.Process.Common.html#std_out"><span class="hs-identifier hs-var">std_out</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StdStream
</span><a href="../../process/src/System.Process.Common.html#CreatePipe"><span class="hs-identifier hs-var">CreatePipe</span></a></span><span>
</span><span id="line-248"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">std_err :: StdStream
</span><a href="../../process/src/System.Process.Common.html#std_err"><span class="hs-identifier hs-var">std_err</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StdStream
</span><a href="../../process/src/System.Process.Common.html#CreatePipe"><span class="hs-identifier hs-var">CreatePipe</span></a></span><span>
</span><span id="line-249"></span><span>                                     </span><span class="hs-special">}</span><span>
</span><span id="line-250"></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680944783"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944783"><span class="hs-identifier hs-var">hStdIn</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680944782"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944782"><span class="hs-identifier hs-var">hStdOut</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680944781"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944781"><span class="hs-identifier hs-var">hStdErr</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944780"><span class="annot"><span class="annottext">ProcessHandle
</span><a href="#local-6989586621680944780"><span class="hs-identifier hs-var">hProcess</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
forall a. IO a -&gt; IO a
</span><a href="#local-6989586621680944788"><span class="hs-identifier hs-var">restore</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
 -&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle))
-&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-251"></span><span>          </span><span class="annot"><span class="annottext">String
-&gt; CreateProcess
-&gt; IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
</span><a href="../../process/src/System.Process.Internals.html#createProcess_"><span class="hs-identifier hs-var">createProcess_</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;builderMainLoop&quot;</span></span><span> </span><span class="annot"><span class="annottext">CreateProcess
</span><a href="#local-6989586621680944787"><span class="hs-identifier hs-var">procdata</span></a></span><span>
</span><span id="line-252"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680944776"><span class="annot"><span class="annottext">cleanup_handles :: IO ()
</span><a href="#local-6989586621680944776"><span class="hs-identifier hs-var hs-var">cleanup_handles</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-253"></span><span>              </span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hClose"><span class="hs-identifier hs-var">hClose</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944783"><span class="hs-identifier hs-var">hStdIn</span></a></span><span>
</span><span id="line-254"></span><span>              </span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hClose"><span class="hs-identifier hs-var">hClose</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944782"><span class="hs-identifier hs-var">hStdOut</span></a></span><span>
</span><span id="line-255"></span><span>              </span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hClose"><span class="hs-identifier hs-var">hClose</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944781"><span class="hs-identifier hs-var">hStdErr</span></a></span><span>
</span><span id="line-256"></span><span>        </span><span id="local-6989586621680944775"><span class="annot"><span class="annottext">Either SomeException b
</span><a href="#local-6989586621680944775"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO b -&gt; IO (Either SomeException b)
forall e a. Exception e =&gt; IO a -&gt; IO (Either e a)
</span><a href="../../base/src/Control.Exception.Base.html#try"><span class="hs-identifier hs-var">try</span></a></span><span> </span><span class="annot"><span class="annottext">(IO b -&gt; IO (Either SomeException b))
-&gt; IO b -&gt; IO (Either SomeException b)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IO b -&gt; IO b
forall a. IO a -&gt; IO a
</span><a href="#local-6989586621680944788"><span class="hs-identifier hs-var">restore</span></a></span><span> </span><span class="annot"><span class="annottext">(IO b -&gt; IO b) -&gt; IO b -&gt; IO b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-257"></span><span>          </span><span class="annot"><span class="annottext">Handle -&gt; BufferMode -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hSetBuffering"><span class="hs-identifier hs-var">hSetBuffering</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944782"><span class="hs-identifier hs-var">hStdOut</span></a></span><span> </span><span class="annot"><span class="annottext">BufferMode
</span><a href="../../base/src/GHC.IO.Handle.Types.html#LineBuffering"><span class="hs-identifier hs-var">LineBuffering</span></a></span><span>
</span><span id="line-258"></span><span>          </span><span class="annot"><span class="annottext">Handle -&gt; BufferMode -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hSetBuffering"><span class="hs-identifier hs-var">hSetBuffering</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944781"><span class="hs-identifier hs-var">hStdErr</span></a></span><span> </span><span class="annot"><span class="annottext">BufferMode
</span><a href="../../base/src/GHC.IO.Handle.Types.html#LineBuffering"><span class="hs-identifier hs-var">LineBuffering</span></a></span><span>
</span><span id="line-259"></span><span>          </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680944771"><span class="annot"><span class="annottext">make_reader_proc :: Handle -&gt; IO ThreadId
</span><a href="#local-6989586621680944771"><span class="hs-identifier hs-var hs-var">make_reader_proc</span></a></span></span><span> </span><span id="local-6989586621680944770"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944770"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO ThreadId
</span><a href="../../base/src/GHC.Conc.Sync.html#forkIO"><span class="hs-identifier hs-var">forkIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ThreadId) -&gt; IO () -&gt; IO ThreadId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; Handle -&gt; (String -&gt; String) -&gt; IO ()
</span><a href="GHC.SysTools.Process.html#readerProc"><span class="hs-identifier hs-var">readerProc</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944802"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944770"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944807"><span class="hs-identifier hs-var">filter_fn</span></a></span><span>
</span><span id="line-260"></span><span>          </span><span class="annot"><span class="annottext">IO ThreadId -&gt; (ThreadId -&gt; IO ()) -&gt; (ThreadId -&gt; IO b) -&gt; IO b
forall a b c. IO a -&gt; (a -&gt; IO b) -&gt; (a -&gt; IO c) -&gt; IO c
</span><a href="../../base/src/Control.Exception.Base.html#bracketOnError"><span class="hs-identifier hs-var">bracketOnError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Handle -&gt; IO ThreadId
</span><a href="#local-6989586621680944771"><span class="hs-identifier hs-var">make_reader_proc</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944782"><span class="hs-identifier hs-var">hStdOut</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ThreadId -&gt; IO ()
</span><a href="../../base/src/GHC.Conc.Sync.html#killThread"><span class="hs-identifier hs-var">killThread</span></a></span><span> </span><span class="annot"><span class="annottext">((ThreadId -&gt; IO b) -&gt; IO b) -&gt; (ThreadId -&gt; IO b) -&gt; IO b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">ThreadId
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-261"></span><span>            </span><span class="annot"><span class="annottext">IO ThreadId -&gt; (ThreadId -&gt; IO ()) -&gt; (ThreadId -&gt; IO b) -&gt; IO b
forall a b c. IO a -&gt; (a -&gt; IO b) -&gt; (a -&gt; IO c) -&gt; IO c
</span><a href="../../base/src/Control.Exception.Base.html#bracketOnError"><span class="hs-identifier hs-var">bracketOnError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Handle -&gt; IO ThreadId
</span><a href="#local-6989586621680944771"><span class="hs-identifier hs-var">make_reader_proc</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944781"><span class="hs-identifier hs-var">hStdErr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ThreadId -&gt; IO ()
</span><a href="../../base/src/GHC.Conc.Sync.html#killThread"><span class="hs-identifier hs-var">killThread</span></a></span><span> </span><span class="annot"><span class="annottext">((ThreadId -&gt; IO b) -&gt; IO b) -&gt; (ThreadId -&gt; IO b) -&gt; IO b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">ThreadId
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-262"></span><span>            </span><span class="annot"><span class="annottext">ProcessHandle -&gt; IO b
</span><a href="#local-6989586621680944790"><span class="hs-identifier hs-var">inner</span></a></span><span> </span><span class="annot"><span class="annottext">ProcessHandle
</span><a href="#local-6989586621680944780"><span class="hs-identifier hs-var">hProcess</span></a></span><span>
</span><span id="line-263"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either SomeException b
</span><a href="#local-6989586621680944775"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-264"></span><span>          </span><span class="hs-comment">-- onException</span><span>
</span><span id="line-265"></span><span>          </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span> </span><span id="local-6989586621680944761"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680944761"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-266"></span><span>            </span><span class="annot"><span class="annottext">ProcessHandle -&gt; IO ()
</span><a href="../../process/src/System.Process.html#terminateProcess"><span class="hs-identifier hs-var">terminateProcess</span></a></span><span> </span><span class="annot"><span class="annottext">ProcessHandle
</span><a href="#local-6989586621680944780"><span class="hs-identifier hs-var">hProcess</span></a></span><span>
</span><span id="line-267"></span><span>            </span><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621680944776"><span class="hs-identifier hs-var">cleanup_handles</span></a></span><span>
</span><span id="line-268"></span><span>            </span><span class="annot"><span class="annottext">e -&gt; IO b
forall a e. Exception e =&gt; e -&gt; a
</span><a href="../../base/src/GHC.Exception.html#throw"><span class="hs-identifier hs-var">throw</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680944761"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-269"></span><span>          </span><span class="hs-comment">-- cleanup when there was no exception</span><span>
</span><span id="line-270"></span><span>          </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680944758"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680944758"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-271"></span><span>            </span><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621680944776"><span class="hs-identifier hs-var">cleanup_handles</span></a></span><span>
</span><span id="line-272"></span><span>            </span><span class="annot"><span class="annottext">b -&gt; IO b
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680944758"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-273"></span><span>  </span><span class="annot"><span class="annottext">(ProcessHandle -&gt; IO ExitCode) -&gt; IO ExitCode
forall {b}. (ProcessHandle -&gt; IO b) -&gt; IO b
</span><a href="#local-6989586621680944791"><span class="hs-identifier hs-var">safely</span></a></span><span> </span><span class="annot"><span class="annottext">((ProcessHandle -&gt; IO ExitCode) -&gt; IO ExitCode)
-&gt; (ProcessHandle -&gt; IO ExitCode) -&gt; IO ExitCode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680944757"><span class="annot"><span class="annottext">ProcessHandle
</span><a href="#local-6989586621680944757"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-274"></span><span>    </span><span class="hs-comment">-- we don't want to finish until 2 streams have been complete</span><span>
</span><span id="line-275"></span><span>    </span><span class="hs-comment">-- (stdout and stderr)</span><span>
</span><span id="line-276"></span><span>    </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; Integer -&gt; IO ()
forall {a}. (Eq a, Num a) =&gt; Chan BuildMessage -&gt; a -&gt; IO ()
</span><a href="#local-6989586621680944756"><span class="hs-identifier hs-var">log_loop</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944802"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">2</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>    </span><span class="hs-comment">-- after that, we wait for the process to finish and return the exit code.</span><span>
</span><span id="line-278"></span><span>    </span><span class="annot"><span class="annottext">ProcessHandle -&gt; IO ExitCode
</span><a href="../../process/src/System.Process.html#waitForProcess"><span class="hs-identifier hs-var">waitForProcess</span></a></span><span> </span><span class="annot"><span class="annottext">ProcessHandle
</span><a href="#local-6989586621680944757"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-279"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-280"></span><span>    </span><span class="hs-comment">-- t starts at the number of streams we're listening to (2) decrements each</span><span>
</span><span id="line-281"></span><span>    </span><span class="hs-comment">-- time a reader process sends EOF. We are safe from looping forever if a</span><span>
</span><span id="line-282"></span><span>    </span><span class="hs-comment">-- reader thread dies, because they send EOF in a finally handler.</span><span>
</span><span id="line-283"></span><span>    </span><span id="local-6989586621680944756"><span class="annot"><span class="annottext">log_loop :: Chan BuildMessage -&gt; a -&gt; IO ()
</span><a href="#local-6989586621680944756"><span class="hs-identifier hs-var hs-var">log_loop</span></a></span></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-284"></span><span>    </span><span class="annot"><a href="#local-6989586621680944756"><span class="hs-identifier hs-var">log_loop</span></a></span><span> </span><span id="local-6989586621680944745"><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944745"><span class="hs-identifier hs-var">chan</span></a></span></span><span> </span><span id="local-6989586621680944744"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680944744"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-285"></span><span>      </span><span id="local-6989586621680944743"><span class="annot"><span class="annottext">BuildMessage
</span><a href="#local-6989586621680944743"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; IO BuildMessage
forall a. Chan a -&gt; IO a
</span><a href="../../base/src/Control.Concurrent.Chan.html#readChan"><span class="hs-identifier hs-var">readChan</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944745"><span class="hs-identifier hs-var">chan</span></a></span><span>
</span><span id="line-286"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">BuildMessage
</span><a href="#local-6989586621680944743"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-287"></span><span>        </span><span class="annot"><a href="GHC.SysTools.Process.html#BuildMsg"><span class="hs-identifier hs-type">BuildMsg</span></a></span><span> </span><span id="local-6989586621680944740"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680944740"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-288"></span><span>          </span><span class="annot"><span class="annottext">DynFlags -&gt; WarnReason -&gt; Severity -&gt; SrcSpan -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Driver.Session.html#putLogMsg"><span class="hs-identifier hs-var">putLogMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944808"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span> </span><span class="annot"><span class="annottext">Severity
</span><a href="GHC.Utils.Error.html#SevInfo"><span class="hs-identifier hs-var">SevInfo</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span>
</span><span id="line-289"></span><span>              </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#withPprStyle"><span class="hs-identifier hs-var">withPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="GHC.Utils.Outputable.html#defaultUserStyle"><span class="hs-identifier hs-var">defaultUserStyle</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680944740"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-290"></span><span>          </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; a -&gt; IO ()
</span><a href="#local-6989586621680944756"><span class="hs-identifier hs-var">log_loop</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944745"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680944744"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-291"></span><span>        </span><span class="annot"><a href="GHC.SysTools.Process.html#BuildError"><span class="hs-identifier hs-type">BuildError</span></a></span><span> </span><span id="local-6989586621680944733"><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680944733"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621680944732"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680944732"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-292"></span><span>          </span><span class="annot"><span class="annottext">DynFlags -&gt; WarnReason -&gt; Severity -&gt; SrcSpan -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Driver.Session.html#putLogMsg"><span class="hs-identifier hs-var">putLogMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680944808"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span> </span><span class="annot"><span class="annottext">Severity
</span><a href="GHC.Utils.Error.html#SevError"><span class="hs-identifier hs-var">SevError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; SrcLoc -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpan"><span class="hs-identifier hs-var">mkSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680944733"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680944733"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-293"></span><span>              </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#withPprStyle"><span class="hs-identifier hs-var">withPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="GHC.Utils.Outputable.html#defaultUserStyle"><span class="hs-identifier hs-var">defaultUserStyle</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680944732"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-294"></span><span>          </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; a -&gt; IO ()
</span><a href="#local-6989586621680944756"><span class="hs-identifier hs-var">log_loop</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944745"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680944744"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-295"></span><span>        </span><span class="annot"><span class="annottext">BuildMessage
</span><a href="GHC.SysTools.Process.html#EOF"><span class="hs-identifier hs-var">EOF</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-296"></span><span>          </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; a -&gt; IO ()
</span><a href="#local-6989586621680944756"><span class="hs-identifier hs-var">log_loop</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944745"><span class="hs-identifier hs-var">chan</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680944744"><span class="hs-identifier hs-var">t</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span class="annot"><a href="GHC.SysTools.Process.html#readerProc"><span class="hs-identifier hs-type">readerProc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Control.Concurrent.Chan.html#Chan"><span class="hs-identifier hs-type">Chan</span></a></span><span> </span><span class="annot"><a href="GHC.SysTools.Process.html#BuildMessage"><span class="hs-identifier hs-type">BuildMessage</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-299"></span><span id="readerProc"><span class="annot"><span class="annottext">readerProc :: Chan BuildMessage -&gt; Handle -&gt; (String -&gt; String) -&gt; IO ()
</span><a href="GHC.SysTools.Process.html#readerProc"><span class="hs-identifier hs-var hs-var">readerProc</span></a></span></span><span> </span><span id="local-6989586621680944729"><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944729"><span class="hs-identifier hs-var">chan</span></a></span></span><span> </span><span id="local-6989586621680944728"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944728"><span class="hs-identifier hs-var">hdl</span></a></span></span><span> </span><span id="local-6989586621680944727"><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944727"><span class="hs-identifier hs-var">filter_fn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-300"></span><span>    </span><span class="hs-special">(</span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680944726"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944726"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO String
</span><a href="../../base/src/GHC.IO.Handle.Text.html#hGetContents"><span class="hs-identifier hs-var">hGetContents</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680944728"><span class="hs-identifier hs-var">hdl</span></a></span><span>
</span><span id="line-301"></span><span>        </span><span class="annot"><span class="annottext">[String] -&gt; Maybe BuildMessage -&gt; IO ()
</span><a href="#local-6989586621680944725"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="GHC.SysTools.Process.html#linesPlatform"><span class="hs-identifier hs-var">linesPlatform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621680944727"><span class="hs-identifier hs-var">filter_fn</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944726"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe BuildMessage
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-302"></span><span>    </span><span class="annot"><span class="annottext">IO () -&gt; IO () -&gt; IO ()
forall a b. IO a -&gt; IO b -&gt; IO a
</span><a href="../../base/src/Control.Exception.Base.html#finally"><span class="hs-operator hs-var">`finally`</span></a></span><span>
</span><span id="line-303"></span><span>       </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; BuildMessage -&gt; IO ()
forall a. Chan a -&gt; a -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.Chan.html#writeChan"><span class="hs-identifier hs-var">writeChan</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944729"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="annot"><span class="annottext">BuildMessage
</span><a href="GHC.SysTools.Process.html#EOF"><span class="hs-identifier hs-var">EOF</span></a></span><span>
</span><span id="line-304"></span><span>        </span><span class="hs-comment">-- ToDo: check errors more carefully</span><span>
</span><span id="line-305"></span><span>        </span><span class="hs-comment">-- ToDo: in the future, the filter should be implemented as</span><span>
</span><span id="line-306"></span><span>        </span><span class="hs-comment">-- a stream transformer.</span><span>
</span><span id="line-307"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-308"></span><span>        </span><span id="local-6989586621680944725"><span class="annot"><span class="annottext">loop :: [String] -&gt; Maybe BuildMessage -&gt; IO ()
</span><a href="#local-6989586621680944725"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">Maybe BuildMessage
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-309"></span><span>        </span><span class="annot"><a href="#local-6989586621680944725"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680944718"><span class="annot"><span class="annottext">BuildMessage
</span><a href="#local-6989586621680944718"><span class="hs-identifier hs-var">err</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; BuildMessage -&gt; IO ()
forall a. Chan a -&gt; a -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.Chan.html#writeChan"><span class="hs-identifier hs-var">writeChan</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944729"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="annot"><span class="annottext">BuildMessage
</span><a href="#local-6989586621680944718"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-310"></span><span>        </span><span class="annot"><a href="#local-6989586621680944725"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944717"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944717"><span class="hs-identifier hs-var">l</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944716"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944716"><span class="hs-identifier hs-var">ls</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680944715"><span class="annot"><span class="annottext">Maybe BuildMessage
</span><a href="#local-6989586621680944715"><span class="hs-identifier hs-var">in_err</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span>
</span><span id="line-311"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe BuildMessage
</span><a href="#local-6989586621680944715"><span class="hs-identifier hs-var">in_err</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-312"></span><span>                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680944714"><span class="annot"><span class="annottext">err :: BuildMessage
</span><a href="#local-6989586621680944714"><span class="hs-identifier hs-var">err</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.SysTools.Process.html#BuildError"><span class="hs-identifier hs-type">BuildError</span></a></span><span> </span><span id="local-6989586621680944713"><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680944713"><span class="hs-identifier hs-var">srcLoc</span></a></span></span><span> </span><span id="local-6989586621680944712"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680944712"><span class="hs-identifier hs-var">msg</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-313"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
</span><a href="#local-6989586621680944711"><span class="hs-identifier hs-var">leading_whitespace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944717"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-314"></span><span>                        </span><span class="annot"><span class="annottext">[String] -&gt; Maybe BuildMessage -&gt; IO ()
</span><a href="#local-6989586621680944725"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944716"><span class="hs-identifier hs-var">ls</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BuildMessage -&gt; Maybe BuildMessage
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; SDoc -&gt; BuildMessage
</span><a href="GHC.SysTools.Process.html#BuildError"><span class="hs-identifier hs-var">BuildError</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680944713"><span class="hs-identifier hs-var">srcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680944712"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944717"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-315"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-316"></span><span>                        </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; BuildMessage -&gt; IO ()
forall a. Chan a -&gt; a -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.Chan.html#writeChan"><span class="hs-identifier hs-var">writeChan</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944729"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="annot"><span class="annottext">BuildMessage
</span><a href="#local-6989586621680944714"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-317"></span><span>                        </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO ()
</span><a href="#local-6989586621680944708"><span class="hs-identifier hs-var">checkError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944717"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944716"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-318"></span><span>                  </span><span class="annot"><span class="annottext">Maybe BuildMessage
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-319"></span><span>                        </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO ()
</span><a href="#local-6989586621680944708"><span class="hs-identifier hs-var">checkError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944717"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944716"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-320"></span><span>                  </span><span class="annot"><span class="annottext">Maybe BuildMessage
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO ()
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;readerProc/loop&quot;</span></span><span>
</span><span id="line-321"></span><span>
</span><span id="line-322"></span><span>        </span><span id="local-6989586621680944708"><span class="annot"><span class="annottext">checkError :: String -&gt; [String] -&gt; IO ()
</span><a href="#local-6989586621680944708"><span class="hs-identifier hs-var hs-var">checkError</span></a></span></span><span> </span><span id="local-6989586621680944706"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944706"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680944705"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944705"><span class="hs-identifier hs-var">ls</span></a></span></span><span>
</span><span id="line-323"></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe (String, Int, Int, String)
</span><a href="GHC.SysTools.Process.html#parseError"><span class="hs-identifier hs-var">parseError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944706"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-324"></span><span>                </span><span class="annot"><span class="annottext">Maybe (String, Int, Int, String)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-325"></span><span>                    </span><span class="annot"><span class="annottext">Chan BuildMessage -&gt; BuildMessage -&gt; IO ()
forall a. Chan a -&gt; a -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.Chan.html#writeChan"><span class="hs-identifier hs-var">writeChan</span></a></span><span> </span><span class="annot"><span class="annottext">Chan BuildMessage
</span><a href="#local-6989586621680944729"><span class="hs-identifier hs-var">chan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; BuildMessage
</span><a href="GHC.SysTools.Process.html#BuildMsg"><span class="hs-identifier hs-var">BuildMsg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944706"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-326"></span><span>                    </span><span class="annot"><span class="annottext">[String] -&gt; Maybe BuildMessage -&gt; IO ()
</span><a href="#local-6989586621680944725"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944705"><span class="hs-identifier hs-var">ls</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BuildMessage
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-327"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944703"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944703"><span class="hs-identifier hs-var">file</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944702"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944702"><span class="hs-identifier hs-var">lineNum</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944701"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944701"><span class="hs-identifier hs-var">colNum</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944700"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944700"><span class="hs-identifier hs-var">msg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-328"></span><span>                    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680944699"><span class="annot"><span class="annottext">srcLoc :: SrcLoc
</span><a href="#local-6989586621680944699"><span class="hs-identifier hs-var hs-var">srcLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Int -&gt; Int -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#mkSrcLoc"><span class="hs-identifier hs-var">mkSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944703"><span class="hs-identifier hs-var">file</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944702"><span class="hs-identifier hs-var">lineNum</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944701"><span class="hs-identifier hs-var">colNum</span></a></span><span>
</span><span id="line-329"></span><span>                    </span><span class="annot"><span class="annottext">[String] -&gt; Maybe BuildMessage -&gt; IO ()
</span><a href="#local-6989586621680944725"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680944705"><span class="hs-identifier hs-var">ls</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BuildMessage -&gt; Maybe BuildMessage
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; SDoc -&gt; BuildMessage
</span><a href="GHC.SysTools.Process.html#BuildError"><span class="hs-identifier hs-var">BuildError</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680944699"><span class="hs-identifier hs-var">srcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944700"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span>        </span><span id="local-6989586621680944711"><span class="annot"><span class="annottext">leading_whitespace :: String -&gt; Bool
</span><a href="#local-6989586621680944711"><span class="hs-identifier hs-var hs-var">leading_whitespace</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-332"></span><span>        </span><span class="annot"><a href="#local-6989586621680944711"><span class="hs-identifier hs-var">leading_whitespace</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944697"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944697"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944697"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-333"></span><span>
</span><span id="line-334"></span><span class="annot"><a href="GHC.SysTools.Process.html#parseError"><span class="hs-identifier hs-type">parseError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-335"></span><span id="parseError"><span class="annot"><span class="annottext">parseError :: String -&gt; Maybe (String, Int, Int, String)
</span><a href="GHC.SysTools.Process.html#parseError"><span class="hs-identifier hs-var hs-var">parseError</span></a></span></span><span> </span><span id="local-6989586621680944695"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944695"><span class="hs-identifier hs-var">s0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe (String, String)
</span><a href="GHC.SysTools.Process.html#breakColon"><span class="hs-identifier hs-var">breakColon</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944695"><span class="hs-identifier hs-var">s0</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-336"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944693"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944693"><span class="hs-identifier hs-var">filename</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944692"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944692"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-337"></span><span>                    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe (Int, String)
</span><a href="GHC.SysTools.Process.html#breakIntColon"><span class="hs-identifier hs-var">breakIntColon</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944692"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-338"></span><span>                    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944690"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944690"><span class="hs-identifier hs-var">lineNum</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944689"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944689"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-339"></span><span>                        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe (Int, String)
</span><a href="GHC.SysTools.Process.html#breakIntColon"><span class="hs-identifier hs-var">breakIntColon</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944689"><span class="hs-identifier hs-var">s2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-340"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944688"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944688"><span class="hs-identifier hs-var">columnNum</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680944687"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944687"><span class="hs-identifier hs-var">s3</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-341"></span><span>                            </span><span class="annot"><span class="annottext">(String, Int, Int, String) -&gt; Maybe (String, Int, Int, String)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944693"><span class="hs-identifier hs-var">filename</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944690"><span class="hs-identifier hs-var">lineNum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944688"><span class="hs-identifier hs-var">columnNum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944687"><span class="hs-identifier hs-var">s3</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-342"></span><span>                        </span><span class="annot"><span class="annottext">Maybe (Int, String)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-343"></span><span>                            </span><span class="annot"><span class="annottext">(String, Int, Int, String) -&gt; Maybe (String, Int, Int, String)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944693"><span class="hs-identifier hs-var">filename</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680944690"><span class="hs-identifier hs-var">lineNum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944689"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-344"></span><span>                    </span><span class="annot"><span class="annottext">Maybe (Int, String)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (String, Int, Int, String)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-345"></span><span>                </span><span class="annot"><span class="annottext">Maybe (String, String)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (String, Int, Int, String)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span class="hs-comment">-- | Break a line of an error message into a filename and the rest of the line,</span><span>
</span><span id="line-348"></span><span class="hs-comment">-- taking care to ignore colons in Windows drive letters (as noted in #17786).</span><span>
</span><span id="line-349"></span><span class="hs-comment">-- For instance,</span><span>
</span><span id="line-350"></span><span class="hs-comment">--</span><span>
</span><span id="line-351"></span><span class="hs-comment">-- * @&quot;hi.c: ABCD&quot;@ is mapped to @Just (&quot;hi.c&quot;, \&quot;ABCD\&quot;)@</span><span>
</span><span id="line-352"></span><span class="hs-comment">-- * @&quot;C:\\hi.c: ABCD&quot;@ is mapped to @Just (&quot;C:\\hi.c&quot;, \&quot;ABCD\&quot;)@</span><span>
</span><span id="line-353"></span><span class="annot"><a href="GHC.SysTools.Process.html#breakColon"><span class="hs-identifier hs-type">breakColon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-354"></span><span id="breakColon"><span class="annot"><span class="annottext">breakColon :: String -&gt; Maybe (String, String)
</span><a href="GHC.SysTools.Process.html#breakColon"><span class="hs-identifier hs-var hs-var">breakColon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Maybe (String, String)
</span><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-355"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-356"></span><span>    </span><span class="hs-comment">-- Don't break on Windows drive letters (e.g. @C:\@ or @C:/@)</span><span>
</span><span id="line-357"></span><span>    </span><span id="local-6989586621680944686"><span class="annot"><span class="annottext">go :: String -&gt; String -&gt; Maybe (String, String)
</span><a href="#local-6989586621680944686"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680944685"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944685"><span class="hs-identifier hs-var">accum</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944684"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944684"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Maybe (String, String)
</span><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944685"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944684"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-358"></span><span>    </span><span class="annot"><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680944683"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944683"><span class="hs-identifier hs-var">accum</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'/'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944682"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944682"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Maybe (String, String)
</span><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'/'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944683"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944682"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-359"></span><span>    </span><span class="annot"><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680944681"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944681"><span class="hs-identifier hs-var">accum</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944680"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944680"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; Maybe (String, String)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944681"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944680"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-360"></span><span>    </span><span class="annot"><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680944678"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944678"><span class="hs-identifier hs-var">accum</span></a></span></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621680944677"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944677"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944676"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944676"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Maybe (String, String)
</span><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944677"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944678"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944676"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-361"></span><span>    </span><span class="annot"><a href="#local-6989586621680944686"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680944675"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944675"><span class="hs-identifier hs-var">_accum</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (String, String)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="annot"><a href="GHC.SysTools.Process.html#breakIntColon"><span class="hs-identifier hs-type">breakIntColon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-364"></span><span id="breakIntColon"><span class="annot"><span class="annottext">breakIntColon :: String -&gt; Maybe (Int, String)
</span><a href="GHC.SysTools.Process.html#breakIntColon"><span class="hs-identifier hs-var hs-var">breakIntColon</span></a></span></span><span> </span><span id="local-6989586621680944674"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944674"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944674"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-365"></span><span>                       </span><span class="hs-special">(</span><span id="local-6989586621680944672"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944672"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944671"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944671"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-366"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944672"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isAscii"><span class="hs-identifier hs-var">isAscii</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944672"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944672"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-367"></span><span>                           </span><span class="annot"><span class="annottext">(Int, String) -&gt; Maybe (Int, String)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Int
forall a. Read a =&gt; String -&gt; a
</span><a href="../../base/src/Text.Read.html#read"><span class="hs-identifier hs-var">read</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944672"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944671"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-368"></span><span>                       </span><span class="annot"><span class="annottext">(String, String)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Int, String)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-369"></span><span>
</span><span id="line-370"></span><span class="hs-keyword">data</span><span> </span><span id="BuildMessage"><span class="annot"><a href="GHC.SysTools.Process.html#BuildMessage"><span class="hs-identifier hs-var">BuildMessage</span></a></span></span><span>
</span><span id="line-371"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="BuildMsg"><span class="annot"><a href="GHC.SysTools.Process.html#BuildMsg"><span class="hs-identifier hs-var">BuildMsg</span></a></span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-372"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="BuildError"><span class="annot"><a href="GHC.SysTools.Process.html#BuildError"><span class="hs-identifier hs-var">BuildError</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcLoc"><span class="hs-identifier hs-type">SrcLoc</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-373"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="EOF"><span class="annot"><a href="GHC.SysTools.Process.html#EOF"><span class="hs-identifier hs-var">EOF</span></a></span></span><span>
</span><span id="line-374"></span><span>
</span><span id="line-375"></span><span class="hs-comment">-- Divvy up text stream into lines, taking platform dependent</span><span>
</span><span id="line-376"></span><span class="hs-comment">-- line termination into account.</span><span>
</span><span id="line-377"></span><span class="annot"><a href="GHC.SysTools.Process.html#linesPlatform"><span class="hs-identifier hs-type">linesPlatform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-cpp">
#if !defined(mingw32_HOST_OS)
</span><span class="hs-identifier">linesPlatform</span><span> </span><span class="hs-identifier">ls</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lines</span><span> </span><span class="hs-identifier">ls</span><span class="hs-cpp">
#else
</span><span id="linesPlatform"><span class="annot"><span class="annottext">linesPlatform :: String -&gt; [String]
</span><a href="GHC.SysTools.Process.html#linesPlatform"><span class="hs-identifier hs-var hs-var">linesPlatform</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-382"></span><span class="annot"><a href="GHC.SysTools.Process.html#linesPlatform"><span class="hs-identifier hs-var">linesPlatform</span></a></span><span> </span><span id="local-6989586621680944664"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944664"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-383"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; (String, String)
</span><a href="#local-6989586621680944663"><span class="hs-identifier hs-var">lineBreak</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944664"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-384"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680944662"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944662"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680944661"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944661"><span class="hs-identifier hs-var">xs1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944662"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="GHC.SysTools.Process.html#linesPlatform"><span class="hs-identifier hs-var">linesPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944661"><span class="hs-identifier hs-var">xs1</span></a></span><span>
</span><span id="line-385"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-386"></span><span>   </span><span id="local-6989586621680944663"><span class="annot"><span class="annottext">lineBreak :: String -&gt; (String, String)
</span><a href="#local-6989586621680944663"><span class="hs-identifier hs-var hs-var">lineBreak</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-387"></span><span>   </span><span class="annot"><a href="#local-6989586621680944663"><span class="hs-identifier hs-var">lineBreak</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\r'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944660"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944660"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944660"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-388"></span><span>   </span><span class="annot"><a href="#local-6989586621680944663"><span class="hs-identifier hs-var">lineBreak</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944659"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944659"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944659"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-389"></span><span>   </span><span class="annot"><a href="#local-6989586621680944663"><span class="hs-identifier hs-var">lineBreak</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944658"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944658"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680944657"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944657"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680944656"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944656"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680944655"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944655"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (String, String)
</span><a href="#local-6989586621680944663"><span class="hs-identifier hs-var">lineBreak</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944657"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680944658"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944656"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680944655"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span class="hs-cpp">

#endif
</span></pre></body></html>